package com.google.android.exoplayer2.metadata.scte35;

import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import o.anc;
import o.anq;

public final class SpliceInsertCommand extends SpliceCommand {
    public static final Creator<SpliceInsertCommand> CREATOR = new Creator<SpliceInsertCommand>() {
        public /* synthetic */ Object createFromParcel(Parcel parcel) {
            return ˎ(parcel);
        }

        public /* synthetic */ Object[] newArray(int i) {
            return ˊ(i);
        }

        public SpliceInsertCommand ˎ(Parcel parcel) {
            return new SpliceInsertCommand(parcel);
        }

        public SpliceInsertCommand[] ˊ(int i) {
            return new SpliceInsertCommand[i];
        }
    };
    public final long ʻ;
    public final List<d> ʼ;
    public final long ʽ;
    public final long ˊ;
    public final boolean ˋ;
    public final int ˋॱ;
    public final boolean ˎ;
    public final boolean ˏ;
    public final int ˏॱ;
    public final int ͺ;
    public final boolean ॱ;
    public final boolean ॱॱ;
    public final long ᐝ;

    public static final class d {
        public final long ˊ;
        public final int ˋ;
        public final long ॱ;

        private d(int i, long j, long j2) {
            this.ˋ = i;
            this.ॱ = j;
            this.ˊ = j2;
        }

        public void ˎ(Parcel parcel) {
            parcel.writeInt(this.ˋ);
            parcel.writeLong(this.ॱ);
            parcel.writeLong(this.ˊ);
        }

        public static d ˊ(Parcel parcel) {
            return new d(parcel.readInt(), parcel.readLong(), parcel.readLong());
        }
    }

    private SpliceInsertCommand(long j, boolean z, boolean z2, boolean z3, boolean z4, long j2, long j3, List<d> list, boolean z5, long j4, int i, int i2, int i3) {
        this.ˊ = j;
        this.ˎ = z;
        this.ˏ = z2;
        this.ॱ = z3;
        this.ˋ = z4;
        this.ᐝ = j2;
        this.ʽ = j3;
        this.ʼ = Collections.unmodifiableList(list);
        this.ॱॱ = z5;
        this.ʻ = j4;
        this.ˏॱ = i;
        this.ˋॱ = i2;
        this.ͺ = i3;
    }

    private SpliceInsertCommand(Parcel parcel) {
        boolean z;
        boolean z2 = true;
        this.ˊ = parcel.readLong();
        this.ˎ = parcel.readByte() == (byte) 1;
        if (parcel.readByte() == (byte) 1) {
            z = true;
        } else {
            z = false;
        }
        this.ˏ = z;
        if (parcel.readByte() == (byte) 1) {
            z = true;
        } else {
            z = false;
        }
        this.ॱ = z;
        if (parcel.readByte() == (byte) 1) {
            z = true;
        } else {
            z = false;
        }
        this.ˋ = z;
        this.ᐝ = parcel.readLong();
        this.ʽ = parcel.readLong();
        int readInt = parcel.readInt();
        List arrayList = new ArrayList(readInt);
        for (int i = 0; i < readInt; i++) {
            arrayList.add(d.ˊ(parcel));
        }
        this.ʼ = Collections.unmodifiableList(arrayList);
        if (parcel.readByte() != (byte) 1) {
            z2 = false;
        }
        this.ॱॱ = z2;
        this.ʻ = parcel.readLong();
        this.ˏॱ = parcel.readInt();
        this.ˋॱ = parcel.readInt();
        this.ͺ = parcel.readInt();
    }

    public static SpliceInsertCommand ॱ(anc o_anc, long j, anq o_anq) {
        boolean z;
        long j2;
        boolean z2;
        long j3;
        boolean z3;
        long ˋॱ = o_anc.ˋॱ();
        if ((o_anc.ʽ() & DnsConfig.MAX_CACHE_ENTRIES) != 0) {
            z = true;
        } else {
            z = false;
        }
        boolean z4 = false;
        boolean z5 = false;
        List emptyList = Collections.emptyList();
        int i = 0;
        int i2 = 0;
        int i3 = 0;
        if (z) {
            j2 = -9223372036854775807L;
            z2 = false;
            j3 = -9223372036854775807L;
            z3 = false;
        } else {
            long j4;
            long j5;
            boolean z6;
            long j6;
            int ʽ = o_anc.ʽ();
            boolean z7 = (ʽ & DnsConfig.MAX_CACHE_ENTRIES) != 0;
            boolean z8 = (ʽ & 64) != 0;
            Object obj = (ʽ & 32) != 0 ? 1 : null;
            z2 = (ʽ & 16) != 0;
            if (!z8 || z2) {
                j4 = -9223372036854775807L;
            } else {
                j4 = TimeSignalCommand.ˎ(o_anc, j);
            }
            if (!z8) {
                i3 = o_anc.ʽ();
                emptyList = new ArrayList(i3);
                for (i = 0; i < i3; i++) {
                    int ʽ2 = o_anc.ʽ();
                    j5 = -9223372036854775807L;
                    if (!z2) {
                        j5 = TimeSignalCommand.ˎ(o_anc, j);
                    }
                    emptyList.add(new d(ʽ2, j5, o_anq.ˏ(j5)));
                }
            }
            if (obj != null) {
                j5 = (long) o_anc.ʽ();
                long ˋॱ2 = ((((j5 & 1) << 32) | o_anc.ˋॱ()) * 1000) / 90;
                z6 = (128 & j5) != 0;
                j6 = ˋॱ2;
            } else {
                j6 = -9223372036854775807L;
                z6 = false;
            }
            i = o_anc.ॱॱ();
            i2 = o_anc.ʽ();
            i3 = o_anc.ʽ();
            j3 = j4;
            z3 = z2;
            z5 = z8;
            z4 = z7;
            j2 = j6;
            z2 = z6;
        }
        return new SpliceInsertCommand(ˋॱ, z, z4, z5, z3, j3, o_anq.ˏ(j3), emptyList, z2, j2, i, i2, i3);
    }

    public void writeToParcel(Parcel parcel, int i) {
        int i2;
        int i3 = 1;
        parcel.writeLong(this.ˊ);
        parcel.writeByte((byte) (this.ˎ ? 1 : 0));
        if (this.ˏ) {
            i2 = 1;
        } else {
            i2 = 0;
        }
        parcel.writeByte((byte) i2);
        if (this.ॱ) {
            i2 = 1;
        } else {
            i2 = 0;
        }
        parcel.writeByte((byte) i2);
        if (this.ˋ) {
            i2 = 1;
        } else {
            i2 = 0;
        }
        parcel.writeByte((byte) i2);
        parcel.writeLong(this.ᐝ);
        parcel.writeLong(this.ʽ);
        int size = this.ʼ.size();
        parcel.writeInt(size);
        for (int i4 = 0; i4 < size; i4++) {
            ((d) this.ʼ.get(i4)).ˎ(parcel);
        }
        if (!this.ॱॱ) {
            i3 = 0;
        }
        parcel.writeByte((byte) i3);
        parcel.writeLong(this.ʻ);
        parcel.writeInt(this.ˏॱ);
        parcel.writeInt(this.ˋॱ);
        parcel.writeInt(this.ͺ);
    }
}
